local queststate = getQuestStatus("questname")
if queststate == "complete" then
Your Code
End